package com.mycase.im.boot.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mycase.im.boot.entity.database.ImTest;
import com.mycase.im.boot.exception.CustomException;
import com.mycase.im.boot.mapper.TestMapper;
import com.mycase.im.boot.service.TestService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author ZhuHJay
 * @Date 2021/9/11 14:33
 */
@Service
@Transactional(rollbackFor = CustomException.class)
public class TestServiceImpl extends ServiceImpl<TestMapper, ImTest> implements TestService {

    @Override
    public void testExceptionCanDo(Integer status) {
        if( status == -1 ){
            ImTest imTest = new ImTest();
            save(imTest);
            throw new CustomException("异常抛出去");
        }
    }

}
